<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/BasicTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Rewired Documentation | Actions</title>
<!-- InstanceEndEditable -->
<!-- InstanceParam name="isRoot" type="boolean" value="false" -->
<!-- InstanceParam name="wide" type="boolean" value="false" -->
<link href="files/css/styles.css" rel="stylesheet" type="text/css" />
<!-- Favicons -->
<link rel="icon" type="image/x-icon" href="/projects/rewired/files/images/favicon.ico?v=1" />
<!-- Apple Icons -->
<!-- For iPad with high-resolution Retina display running iOS = 7: -->
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="files/images/favicon_152x152.png?v=1">
<!-- For iPad with high-resolution Retina display running iOS = 6: -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="files/images/favicon_144x144.png?v=1">
<!-- For iPhone with high-resolution Retina display running iOS = 7: -->
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="files/images/favicon_120x120.png?v=1">
<!-- For iPhone with high-resolution Retina display running iOS = 6: -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="files/images/favicon_114x114.png?v=1">
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 7: -->
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="files/images/favicon_76x76.png?v=1">
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 6: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="files/images/favicon_72x72.png?v=1">
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="files/images/favicon_57x57.png?v=1">
</head>

<body>


<div class="container">

    <div class="google-search-bar">
        <script>
          (function() {
            var cx = '007961148920562332911:oocvtwz5jce';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
          })();
        </script>
        <gcse:search></gcse:search>
    </div>

  <div class="content">
	
	
	 
    <div class="page-body">
	
    
         
	    
      	<div class="sidebar-nav">
	        <h4><a href="Documentation.html">Documentation</a></h4>
	        <ul>
	          <li><a href="Overview.html">Overview</a></li>
	          <li><a href="ReleaseNotes.txt">Release Notes</a></li>
          </ul>
	        <strong>Essentials:</strong>
            <ol>
              <li><a href="Installation.html">Installation</a></li>
              <li><a href="QuickStart.html">Quick Start</a></li>
              <li><a href="BasicUsage.html">Basic Usage</a></li>
              <li><a href="Deployment.html">Deployment</a></li>
              <li><a href="BestPractices.html">Best Practices</a></li>
              <li><a href="RewiredEditor.html">Rewired Editor</a></li>
              <li><a href="https://guavaman.com/projects/rewired/docs/api-reference" target="_blank">API Reference</a></li>
            </ol>
            <strong>Concepts:</strong>
            <ul>
              <li><a href="InputManager.html">Input Manager</a></li>
              <li><a href="Players.html">Players</a></li>
              <li><a href="Actions.html">Actions</a></li>
              <li><a href="InputBehaviors.html">Input Behaviors</a></li>
              <li><a href="Controllers.html">Controllers</a></li>
              <li><a href="ControllerMaps.html">Controller Maps</a></li>
              <li><a href="ControllerTemplates.html">Controller Templates</a></li>
              <li><a href="MapCategories.html">Map Categories</a></li>
              <li><a href="Layouts.html">Layouts</a></li>
              <li><a href="LayoutManager.html">Layout Manager</a></li>
              <li><a href="MapEnabler.html">Map Enabler</a></li>
              <li><a href="CustomControllers.html">Custom Controllers</a></li>
            </ul>
            <strong>Extras:</strong>
            <ul>
              <li><a href="ControlMapper.html" title="Control Mapper">Control Mapper</a></li>
	          <li><a href="TouchControls.html" title="Touch Controls">Touch Controls</a></li>
              <li><a href="RewiredStandaloneInputModule.html">Rewired Standalone Input Module</a></li>
	          <li><a href="UnityInputOverride.html" title="Unity Input Override">Unity Input Override</a></li>
            </ul>
            <strong>Misc:</strong>
            <ul>
	          <li><a href="ComponentControls.html" title="Component Controls">Component Controls</a></li>
	          <li><a href="PlayerControllers.html" title="Player Controllers">Player Controllers</a></li>
	          <li><a href="InputMapper.html" title="Input Mapper">Input Mapper</a></li>
	          <li><a href="UserDataStore.html" title="User Data Store">User Data Store</a></li>
            </ul>
            <strong>How To's:</strong>
            <ul>
            	<li><a href="HowTos.html">See all topics...</a></li>
            </ul>
            <strong>Help:</strong>
            <ul>
              <li><a href="SupportedControllers.html" title="Supported Controllers">Supported Controllers</a></li>
              <li><a href="Overview.html#tested-platforms" title="Tested Platforms">Tested Platforms</a></li>
              <li><a href="Troubleshooting.html" title="Troubleshooting">Troubleshooting</a></li>
              <li><a href="KnownIssues.html">Known Issues</a></li>
              <li><a href="SpecialPlatformSupport.html" title="Special Platform Support">Special Platform Support</a></li>
	          <li><a href="Examples.html" title="Examples">Examples</a></li>
              <li><a href="Integration.html">Integrations</a></li>
	          <li><a href="Updating.html" title="Updating Rewired">Updating Rewired</a></li>
            </ul>
            <strong>FAQ</strong>
            <ul>
            	<li><a href="FAQ.html">See all topics...</a></li>
            </ul>
            <strong>Unity Help:</strong>
            <ul>
              <li><a href="https://docs.unity3d.com/Manual/" target="_blank">Unity Manual</a></li>
              <li><a href="https://docs.unity3d.com/ScriptReference/" target="_blank">Unity Script Reference</a></li>
              <li><a href="https://unity3d.com/learn/tutorials/modules" target="_blank">Unity Tutorials</a></li>
            </ul>
            <strong>Links:</strong>
            <ul>
              <li><a href="https://guavaman.com/projects/rewired">Rewired Website</a></li>
              <li><a href="https://guavaman.com/projects/rewired/docs">Web Documentation</a></li>
            </ul>
        </div>
        
    
    	<div class="main-body">
	        <div class="logo"><a href="https://guavaman.com/projects/rewired" title="Rewired"><img src="files/images/rewired-logo.png" width="173" height="139" alt="Rewired" /></a></div>
                     
            <h1>
            <!-- InstanceBeginEditable name="PageHeader" -->Actions
      <!-- InstanceEndEditable -->
            </h1>
            
			<!-- InstanceBeginEditable name="MainBody" -->

    <p>An Action can represent any type of event that should take place as a result of input. Generally, Actions are named for the in-game action they represent, such as: Move Horizontal, Jump, Fire, Reload, Change Weapon, Punch, etc. Actions can also represent system actions such as Menu, Save, Load, Cancel, Back, Forward, etc. How you name and use Actions is entirely up to your game's needs.</p>
    <p><strong>Getting Input</strong></p>
    <p>Actions are generally how you get input in Rewired. Instead of getting input from a specific button on a specific controller which may change if the user switches controllers, you get input from the Action through the <a href="https://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_Player.htm">Player</a> class. For example:</p>
    <pre class="code">
private Rewired.Player player;

void Awake() {
    player = Rewired.ReInput.players.GetPlayer(0); <span class="comment">// get the player by id</span>
}

void Update() {
    player.GetButtonDown("Fire");
}</pre>
    <p>This way, you don't have to worry about what type or how many controllers the player is using -- you simply get your input based on the Action.</p>
    <p>You can also get input based on the Action id instead. The Action id is displayed in the <a href="RewiredEditor.html#Actions">Rewired Editor under Actions</a>. You can <a href="HowTos.html#exporting-constants">export a list of Action Id constants</a> which adds the convenience of letting you use your IDE's auto-complete  to find Actions when coding. Looking up Actions by id is significantly faster than by name and is  the recommended method.</p>
    <p>Additionally, you have the option of using input events instead of polling for input as shown in the above example. See <a href="HowTos.html#get-input">How To's - Getting Input</a> for more information.</p>
    <p><strong>Buttons and Axes</strong></p>
    <p>An Action is neither a button nor an axis. An Action is a virtual element 
      that can be queried as both a button (boolean value) and an axis (floating 
      point value). All <a href="https://guavaman.com/projects/rewired/docs/api-reference/html/T_Rewired_Player.htm">Player Button and Axis methods</a> work regardless of what type or how many 
      underlying elements make up the value of the Action.</p>
    <p>When querying an Action's Button value, if the underlying element bound to the Action is a physical or virtual axis, the Action's <a href="InputBehaviors.html#button-dead-zone">Input Behavior Button Dead Zone</a> is used to determine at what axis value the Button state change occurs. In addition, an underlying axis will only trigger a Button state change based on a positive axis value. If the axis has a negative value, this value is ignored for the purposes of the Button state, but instead contributes to a Negative Button state. <a href="HowTos.html#button-press-types-negative-buttons">See this form more information</a>.</p>
    <p>When querying an Action's Axis value, if the underlying element bound to the Action is a physical or virtual button, the Action's <a href="InputBehaviors.html#digital-axis-settings">Input Behavior Digital Axis Settings</a> are used to determine how the axis value is calculated.    </p>
    <p><strong>Creating/Editing Actions</strong></p>
    <p>You must create and edit Actions in the <a href="RewiredEditor.html">Rewired Editor</a>. See <a href="RewiredEditor.html#Actions">Rewired Editor - Actions</a> for more information.</p>
    <p><strong>Action Categories</strong></p>
    <p>Actions can be categorized into different lists through the use of Action Categories.</p>
    <p>Action Categories are only for organizational purposes in the Rewired Editor or in lists of Actions for displaying in a UI (a control remapping screen, for example). They have no impact whatsoever on what controls are mapped in a Player and do not affect input in any way.</p>
    <p><strong>Rewired&rsquo;s Purpose and Responsibilities</strong></p>
    <p>It is common for Rewired's Action system to be used in an unintended manner as an integral part of or in place of a separate game state management system. This is not what Rewired was designed for and not how it is intended to be used.
    </p>
    <ul>
      <li>Rewired&rsquo;s sole purpose is to read user input.</li>
      <li>All &ldquo;Actions&rdquo; in Rewired are actually &ldquo;Input Actions&rdquo; and should not be   used for any other purpose than to get information about the user&rsquo;s intent. They should   not be confused with or used as game states or actions.</li>
      <li>The Action &ldquo;Jump&rdquo; does not designate &ldquo;Player is jumping,&rdquo; but rather &ldquo;The   user wants to jump.&rdquo;</li>
      <li>The game should implement permission and state management systems that   evaluate user input and then change states. After that point, what happens is outside the   responsibility of the input system.</li>
</ul>
    <h3></h3>
    <p>&nbsp;</p>
    <div class="bottom-pager clearfix">
      <a class="back-button" href="Players.html" title="Players"><span class="button-img"></span>Players</a>
      <a class="forward-button" href="InputBehaviors.html" title="Input Behaviors"><span class="button-img"></span>Input Behaviors</a>
    </div>

<!-- InstanceEndEditable -->
        </div>
        
    </div>
  <div class="footer clearfix">
   	<p class="left">Copyright &copy;2014-2021 <a href="https://guavaman.com" title="Guavaman Enterprises">Guavaman Enterprises</a>. All rights reserved. No materials may be reproduced without permission.</p>
  	<p class="right"><a href="https://guavaman.com/projects/rewired" title="Return to Rewired Website">Return to Rewired Website</a></p>
  </div>
  <!-- end .content --></div>
  <!-- end .container --></div>
  
  
</body>
<!-- InstanceEnd --></html>
